function TableProduces(container, item, options) {
  this._container = container;
  this._item = item;
  this._options = options;
  this._updated = (options && options.updated) ? options.updated : null;
  this._noExist = (options && options.noExist) ? options.noExist : false;
  this._isSupervise = (options && options.s) ? options.s : 0;
  
  this._createElements();
};

TableProduces.prototype._createElements = function() {
  var gui, table, _self = this, unique = MiscUtils.unique();
  
  DOMUtils.removeChildElements(this._container);
  DOMUtils.removeChildElements(this._updated);

  if (!this._noExist && !this._options.mails && !this._isSupervise) {
    var table1 = document.createElement('table');
    table1.style.width = '740px';
    table1.style.height = '24px';
    table1.cellPadding = 0;
    table1.cellSpacing = 0;
    this._updated.appendChild(table1);
    
    tr = table1.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.width = '370px';
    td.style.height = '25px';
    td.style.textAlign = 'left';
    td.style.verticalAlign = 'bottom';
    td.style.fontSize = '120%';
    td.style.fontWeight = 'bold';
    td.style.color = ' #633e36';
    td.style.paddingBottom = '4px';
    td.appendChild(document.createTextNode('Last Updated'));
    td = tr.insertCell(-1);
    td.style.width = '370px';
    td.style.height = '15px';
    td.style.textAlign = 'right';
    td.style.verticalAlign = 'bottom';
    td.style.paddingBottom = '2px';
    var div = document.createElement('div');
    div.id = unique + '_more_div';
    td.appendChild(div);
    
    tr = table1.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.width = '740px';
    td.colSpan = '2';
    var table2 = document.createElement('table');
    table2.style.width = '740px';
    table2.cellPadding = 0;
    table2.cellSpacing = 0;
    table2.style.borderTop = 'solid 1px #b4b4b4';
    table2.style.borderLeft = 'solid 1px #b4b4b4';
    table2.id = unique + '_lastUpdated_table';
    td.appendChild(table2);
    
    tr = table2.insertRow(-1);
    tr.style.backgroundColor = '#eeeeee';
    td = tr.insertCell(-1);
    td.style.width = '97px';
    td.style.height = '20px';
    td.style.textAlign = 'left';
    td.style.padding = '0 0 0 10px';
    td.style.verticalAlign = 'middle';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '8pt';
    td.style.color = '#888888';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    td.appendChild(document.createTextNode('Customers'));
    
    td = tr.insertCell(-1);
    td.style.width = '127px';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    
    td = tr.insertCell(-1);
    td.style.width = '110px';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    
    td = tr.insertCell(-1);
    td.style.width = '250px';
    td.style.textAlign = 'left';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '8pt';
    td.style.color = '#888888';
    td.style.padding = '0 0 0 10px';
    td.style.verticalAlign = 'middle';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    td.appendChild(document.createTextNode('Tasks'));
    
    td = tr.insertCell(-1);
    td.style.width = '83px';
    td.style.textAlign = 'left';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '8pt';
    td.style.color = '#888888';
    td.style.padding = '0 0 0 10px';
    td.style.verticalAlign = 'middle';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    td.appendChild(document.createTextNode('Operator'));
    
    td = tr.insertCell(-1);
    td.style.width = '78px';
    td.style.textAlign = 'left';
    td.style.fontWeight = 'bold';
    td.style.fontSize = '8pt';
    td.style.color = '#888888';
    td.style.padding = '0 0 0 10px';
    td.style.verticalAlign = 'middle';
    td.style.borderBottom = 'solid 1px #b4b4b4';
    td.style.borderRight = 'solid 1px #b4b4b4';
    td.appendChild(document.createTextNode('Date'));
    
    var table3 = document.createElement('table');
    table3.style.backgroundColor = '#d9d6cd';
    table3.style.width = '740px';
    table3.style.height = '24px';
    table3.cellPadding = 0;
    table3.cellSpacing = 0;
    table3.border=0
    this._updated.appendChild(table3);
    
    tr = table3.insertRow(-1);
    td = tr.insertCell(-1);
    td.style.width = '740px';
    td.style.height = '24px';
    td.style.textAlign = 'right';
    td.style.verticalAlign = 'middle';
    td.style.padding = '13px 0 0';
    var btn = DOMUtils.createInput('', '', 'button', '', null);
    btn.className = "addtask";
    btn.style.width = '135px';
    btn.style.height = '25px';
    btn.id = unique + '_addTask_button';
    td.appendChild(btn);
  }
  
  
  table = document.createElement('table');
  table.style.width = '740px';
  table.style.height = '24px';
  table.cellPadding = 0;
  table.cellSpacing = 0;
  table.style.borderTop = 'solid 1px #694247';
  table.style.borderLeft = 'solid 1px #694247';
  table.id = unique + '_produce_table';
  this._container.appendChild(table);
  
  tr = table.insertRow(-1);
  tr.style.backgroundColor = '#7a5052';
  td = tr.insertCell(-1);
  td.style.width = '108px';
  td.style.height = '24px';
  td.style.fontWeight = 'bold';
  td.style.fontSize = '100%';
  td.style.color = 'white';
  td.style.padding = '0 0 0 10px';
  td.style.textAlign = 'left';
  td.style.fontFamily = 'Arial';
  td.style.verticalAlign = 'middle';
  td.style.borderRight = 'solid 1px #ffffff';
  td.appendChild(document.createTextNode('Customers'));
  
  td = tr.insertCell(-1);
  td.style.width = '124px';
  td.style.height = '24px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  td.style.borderRight = 'solid 1px #ffffff';
  
  td = tr.insertCell(-1);
  td.style.width = '62px';
  td.style.height = '24px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  td.style.borderRight = 'solid 1px #ffffff';
  
  td = tr.insertCell(-1);
  td.style.width = '190px';
  td.style.height = '24px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  td.style.fontWeight = 'bold';
  td.style.fontSize = '100%';
  td.style.color = 'white';
  td.style.padding = '0 0 0 10px';
  td.style.borderRight = 'solid 1px #ffffff';
  td.appendChild(document.createTextNode('Tasks'));
  
  td = tr.insertCell(-1);
  td.style.height = '24px';
  td.style.width = '45px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  td.style.fontWeight = 'bold';
  td.style.fontSize = '100%';
  td.style.color = 'white';
  td.style.padding = '0 0 0 10px';
  td.style.borderRight = 'solid 1px #ffffff';
  td.appendChild(document.createTextNode('D / W'));
  
  td = tr.insertCell(-1);
  td.style.width = '180px';
  td.style.height = '24px';
  td.style.textAlign = 'left';
  td.style.verticalAlign = 'middle';
  
  gui = GuiTableProduces.instance(unique);
  new HandleTableProduces(gui, this._item, this._options);
};